class HealthPotion extends Item {
    constructor(size = 'small') {
        const config = size === 'small' ? {
            id: 'small_health_potion',
            name: '小血瓶',
            description: '恢复30%生命值',
            price: 100,
            healPercent: 0.3
        } : {
            id: 'large_health_potion',
            name: '大血瓶',
            description: '恢复60%生命值',
            price: 200,
            healPercent: 0.6
        };
        
        super(config.id, config.name, config.description, config.price, ItemType.CONSUMABLE);
        this.healPercent = config.healPercent;
    }

    use(character) {
        const healAmount = Math.floor(character.maxHp * this.healPercent);
        character.heal(healAmount);
        return `恢复了${healAmount}点生命值`;
    }
}

class MagicCloak extends Item {
    constructor() {
        super(
            'magic_cloak',
            '魔力斗篷',
            '增加20%最大生命值',
            300,
            ItemType.EQUIPMENT
        );
    }

    use(character) {
        character.maxHp = Math.floor(character.maxHp * 1.2);
        character.hp = character.maxHp;
        return '最大生命值增加20%';
    }
}

const ShopItems = [
    new HealthPotion('small'),
    new HealthPotion('large'),
    new MagicCloak()
]; 